'use strict';
/** @type {import('sequelize-cli').Migration} */
module.exports = {
  async up(queryInterface, Sequelize) {
    await queryInterface.createTable('admin', {
      id: {
        allowNull: false,
        autoIncrement: true,
        primaryKey: true,
        type: Sequelize.INTEGER
      },
      username: {
        type: Sequelize.STRING(100),
        allowNull: false,
        defaultValue: '',
        comment: '用户名'
      },
      account: {
        type: Sequelize.STRING(100),
        unique: true,
        allowNull: false,
        comment: '账号'
      },
      password: {
        type: Sequelize.STRING(128),
        allowNull: false,
        comment: '密码'
      },
      avatar: {
        type: Sequelize.STRING,
        allowNull: false,
        comment: '头像'
      },
      mobile: {
        type: Sequelize.CHAR(11),
        allowNull: false,
        defaultValue: ''
      },
      status: {
        type: Sequelize.TINYINT,
        defaultValue: 1,
        comment: '账号状态'
      },
      last_login_time: {
        type: Sequelize.DATE,
        comment: '最后登录时间'
      },
      last_login_ip: {
        type: Sequelize.STRING(100),
        defaultValue: '',
        comment: '最后登录ip'
      },
      created_at: {
        allowNull: false,
        type: Sequelize.DATE
      },
      updated_at: {
        allowNull: false,
        type: Sequelize.DATE
      }
    });
  },
  async down(queryInterface, Sequelize) {
    await queryInterface.dropTable('admin');
  }
};